技術問答
技術文章
iT 徵才
Tag
聊天室
2025 鐵人賽
登入/註冊
問答
文章
Tag
邦友
鐵人賽
搜尋
第 11 屆 iThome 鐵人賽
DAY
26
0
自我挑戰組
CSS 大全(第四版)閱讀筆記
系列 第
26
篇
day26【主題六:選擇器】筆記1
11th鐵人賽
Amy
2019-09-27 23:19:17
748 瀏覽
分享至
元素選擇器:通常指的是HTML元素(因為XML允許使用者建立新的標記)。
一個ID值在一份HTML文件只能出現一次,不允許用空白分隔多重值。
class和ID值定義區分大小寫。
屬性選擇器,h1 [class]
選擇空元素,: empty
選擇唯一的子代,: only-child
其他選取技巧(書籍「 CSS Secrets 中文版解決網頁設計問題的有效秘訣」)
當列表中只有一個列表項時,我們把刪除按鈕隱藏起來了;這個需求是可以由 :only-child 選擇符來完成的
only-child 等效於:first-child:last-child如果第一項同時也是最後一項(它就是唯一的那一項)
only-child 也等效於 :nth-last-child(1)
li:first-child:nth-last-child(4), li:first-child:nth-last-child(4) ~ li {
/* 當列表正好包含四項時,命中所有列表項
/}
li:first-child:nth-last-child(n+4), li:first-child:nth-last-child(n+4) ~ li {
/
當列表至少包含四項時,命中所有列表項
/}
li:first-child:nth-last-child(-n+4), li:first-child:nth-last-child(-n+4) ~ li {
/
當列表最多包含四項時,命中所有列表項
/}
li:first-child:nth-last-child(n+2):nth-last-child(-n+6), li:first-child:nth-last-child(n+2):nth-last-child(-n+6) ~ li {
/
當列表包含2~6項時,命中所有列表項 */
}
留言
追蹤
檢舉
上一篇
day25【主題五:濾鏡、混合、裁切與遮罩】裁切與合成遮罩、縮寫、類型、邊框、定位
下一篇
day27【主題六:選擇器】筆記2
系列文
CSS 大全(第四版)閱讀筆記
共
30
篇
目錄
RSS系列文
訂閱系列文
17
人訂閱
26
day26【主題六:選擇器】筆記1
27
day27【主題六:選擇器】筆記2
28
day28【主題六:選擇器】筆記3-動態、介面狀態虛擬類別
29
day29【主題七:邊界範圍】
30
day30【主題八:數值與單位】
完整目錄
熱門推薦
{{ item.subject }}
{{ item.channelVendor }}
|
{{ item.webinarstarted }}
|
{{ formatDate(item.duration) }}
直播中
立即報名
尚未有邦友留言
立即登入留言
iThome鐵人賽
參賽組數
902
組
團體組數
37
組
累計文章數
19009
篇
完賽人數
404
人
看影片追技術
看更多
{{ item.subject }}
{{ item.channelVendor }}
|
{{ formatDate(item.duration) }}
直播中
熱門tag
看更多
15th鐵人賽
16th鐵人賽
13th鐵人賽
14th鐵人賽
17th鐵人賽
12th鐵人賽
11th鐵人賽
鐵人賽
2019鐵人賽
javascript
2018鐵人賽
python
2017鐵人賽
windows
php
c#
linux
windows server
css
react
熱門問題
樹莓派架站
關於powershell dns policy 同步問題
Zoom分享時黑屏
大家都會如何使用 Gemini CLI 或其他CLI工具
unifi 無線設定
git登入不了
C# Entity Framework建立實體模型問題
How to integrate an online electricity bill API on a website?
Windows 11 專業版 (筆電) 重灌
熱門回答
Windows 11 專業版 (筆電) 重灌
關於powershell dns policy 同步問題
unifi 無線設定
How to integrate an online electricity bill API on a website?
熱門文章
第23天,pkcs11-tool 分析自然人憑證 / 大鐤肉羹 (新北萬華) | 30天滷肉飯
Ch 22. 為什麼程式設計師喜歡用蘋果電腦?
Day23 - 影子寄生術,操弄世界的魁儡:Process Injection 之 Mapping Injection
【LOLBAS鐵人賽Day26】LOLBAS 攻擊鏈:從 Excel 到完全控制
[為你自己學 n8n] 第 28 天,網友許願之電子採購網
IT邦幫忙
×
標記使用者
輸入對方的帳號或暱稱
Loading
找不到結果。
標記
{{ result.label }}
{{ result.account }}